<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../源码/jquery-1.8.1.js"></script>
    <script>
      $(function () {
        // dom.css(name|pro|[,val|fn])
        // 1.逐个设置
        $("div").css("background", "orange");
        $("div").css("width", "200px");
        $("div").css("height", "200px");

        // 2.链式设置
        //注意:链式写法不适合与接多条css方法
        $("p").css("color", "red").css("fontSize", "28px");

        // 3.批量设置
        $("span").css({
          color: "blue",
          fontSize: "28px",
        });

        // 4.获取DOM元素后的样式值
        console.log($("p").css("font"));
      });
    </script>
  </head>
  <body>
    <div>1</div>
    <p>这是一段落,可继而设置样式</p>
    <span>这是二段落,可继而设置样式</span>
  </body>
</html>
